const state ={
    appname:'Vue 管理后台',
    username:'',
    userid:'-1',
    powercode:'',
    token:'',
    activemenu:'empty'
};

const mutations ={
    //在这里token 加上了 Bearer
    setUserinfo(state,{username,userid,powercode,token}){
        state.username = username;
        state.userid = userid;
        state.powercode = powercode;
        state.token ='Bearer '+ token;
    },
    setActivemenu(state,clickmenuIndex){
        state.activemenu = clickmenuIndex;
        window.localStorage.setItem('activemenu',clickmenuIndex);
    }
};

const actions = {
    setUserinfo(context,{username,userid,powercode,token}){
    console.log('kk');
        context.commit('setUserinfo',{username,userid,powercode,token});
    },
    setActivemenu(context,clickmenu){
        context.commit('setActivemenu',clickmenu);
    }
};

const getters = {

};
export default {
    namespaced:true,
    state,
    mutations,
    actions,
    getters
}